package com.aaa.depression.controller;

import com.aaa.depression.service.DepressionTestResultService;
import com.aaa.pojo.DepressionResult;
import com.aaa.pojo.Page;
import com.aaa.pojo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/account")
@ResponseBody
public class DepressionTestResultController {

    @Autowired
    private DepressionTestResultService depressionTestResultService;
    @RequestMapping("/findAllResult")
    public ResultBean findAll(Page page , DepressionResult depressionResult){
        return depressionTestResultService.findAll(page,depressionResult);
    }
    @RequestMapping("/deleteResult")
    public int delete(Integer id){
        int delete = depressionTestResultService.delete(id);

        return delete;
    }
    @RequestMapping("/deletesResult")
    public int deletes(@RequestParam Integer[] id){
        return depressionTestResultService.deletes(id);
    }

    @RequestMapping("/check")
    public ResultBean<DepressionResult> check(DepressionResult depressionResult){
        /*System.out.println(view);*/
        DepressionResult result = depressionTestResultService.check(depressionResult);
        ResultBean<DepressionResult> resultSas = new ResultBean<>();
        resultSas.setCode(0);
        resultSas.setMsg("");
        resultSas.setCount(1L);
        resultSas.setData(result);
        return resultSas;
    }
}
